package com.fcscs.cservice.service;

import java.io.InputStream;
import java.util.Date;
import java.util.List;

import org.springframework.stereotype.Service;

import com.fcscs.cservice.common.CServiceCommonEnums.BookingStatus;
import com.fcscs.cservice.common.CServiceCommonEnums.BookingViewOrderBy;
import com.fcscs.cservice.common.CServiceCommonEnums.GuestProfileType;
import com.fcscs.cservice.domain.BookingBase;
import com.fcscs.cservice.domain.Country;
import com.fcscs.cservice.domain.model.BookingIdAndMessage;
import com.fcscs.cservice.domain.model.BookingIdAndStatus;
import com.fcscs.cservice.domain.model.BookingUpdate;
import com.fcscs.cservice.domain.model.BookingView;
import com.fcscs.cservice.domain.model.NonInHouseGuestProfile;

@Service
public interface BookingManager {

	/**
	 * @param <E>
	 * @param cls
	 * @param id
	 * @return
	 */
	<E extends BookingBase> E get(Class<E> cls, long id);

	/**
	 * @param id
	 * @return
	 */
	BookingBase get(long id);

	/**
	 * @param loc
	 * @return
	 */
	Boolean delete(BookingBase loc);

	/**
	 * @param loc
	 */
	void permDelete(BookingBase loc);

	
	/**
	 * @param <E>
	 * @param loc
	 * @return
	 */
	<E extends BookingBase> E save(E loc);

	/**
	 * @param orgId
	 * @param propId
	 * @param restaurantId
	 * @param term
	 * @param start
	 * @param resultCnt
	 * @return
	 */
	List<BookingView> simFindBookings(Long propId,Long restaurantId,String term,Date reservationDate,int start,int resultCnt);
	
	/**
	 * @param orgId
	 * @param propId
	 * @param restaurantId
	 * @param term
	 * @param start
	 * @param resultCnt
	 * @return
	 */
	int simFindBookingsCnt(Long propId,Long restaurantId,String term,Date reservationDate);
	
	/**
	 * @param orgId
	 * @param propId
	 * @param restaurantId
	 * @param term
	 * @param firstName
	 * @param lastName
	 * @param mobileNo
	 * @param reservationDate
	 * @param statuses
	 * @param start
	 * @param resultCnt
	 * @param orderBy
	 * @param sortDesc
	 * @return
	 */
	List<BookingView> findBookings(Long propId, Long restaurantId, String term, String firstName,
			String lastName, String mobileNo,GuestProfileType guestType,
			Date reservationDate, List<BookingStatus> statuses,
			Date startDate,Date endDate,int start,int resultCnt, BookingViewOrderBy orderBy, boolean sortDesc);

	/**
	 * @param orgId
	 * @param propId
	 * @param restaurantId
	 * @param term
	 * @param firstName
	 * @param lastName
	 * @param mobileNo
	 * @param reservationDate
	 * @param statuses
	 * @return
	 */
	int findBookingsCnt(Long propId, Long restaurantId, String term, String firstName, String lastName,
			String mobileNo, GuestProfileType guestType, Date reservationDate, List<BookingStatus> statuses,Date startDate,Date endDate);

	
	/**
	 * updateBookingStatus 
	 * @param propId property id
	 * @param idstatus list of bookingIdAndStatus
	 * @return
	 */
	List<BookingIdAndMessage> updateBookingStatus(Long propId,List<BookingIdAndStatus> idstatus);

	/**
	 * getBookingHistory 
	 * @param propId property id
	 * @param guestId guest profile id
	 * @param start 0 based start index
	 * @param resultCnt max result count limit
	 * @return
	 */
	List<BookingView> getBookingHistory(Long propId,long guestId, int start, int resultCnt); 
	
	/**
	 * getBookingHistoryCnt 
	 * @param propId property id
	 * @param guestId guest profile id
	 * @return
	 */
	int getBookingHistoryCnt(Long propId,long guestId);
	
	/**
	 * createBooking 
	 * @param bkBase BookingBase
	 * @param nonInGuest non-in-house guestProfile
	 * @return
	 */
	BookingView createBooking(BookingBase bkBase,NonInHouseGuestProfile nonInGuest);
	
	/**
	 * @param bookingUpdate  BookingUpdate model
	 * @return
	 */
	BookingView updateBooking(BookingUpdate bookingUpdate);
	
	/**
	 * @return list<Country>
	 */
	List<Country> seedCountry(Long propId,String path);
	
	
	/**
	 * @return
	 */
	InputStream readImageFromDataBase();
}
